using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.IO.Ports;
using System.Linq;
using System.Net.Sockets;
using System.Windows.Forms;
using System.Xml;
using HslCommunication.Core;
using HslCommunication.ModBus;
using HslCommunication.Profinet.Siemens;
using Opc.Ua;
using OpcUaHelper;
using WIT.DAQ.Core.Enums;
using WIT.DAQ.Core.Models;
using WIT.DAQ.Core.Properties;
using WIT.DAQ.Core.Protocols.Socket;

namespace WIT.DAQ.Core.Forms;

/// <summary>
/// 数据采集管理界面
/// </summary>
internal class DAQMgrForm : BaseForm
{
	/// <summary>
	/// 缓存设备列表
	/// </summary>
	private List<Device> DEVICES;

	/// <summary>
	/// Required designer variable.
	/// </summary>
	private IContainer components = null;

	private TabControl tcMain;

	private TabPage tpItems;

	private TabPage tpTasks;

	private ComboBox cmbStations;

	private Label label1;

	private TreeView tvDAQItems;

	private Button btnDel;

	private Button btnAdd;

	private ContextMenuStrip cmsDAQItem;

	private ToolStripMenuItem tsmiEdit;

	private ToolStripMenuItem tsmiDel;

	private Panel pnlContainer;

	private ImageList imageList;

	private Button btnDelTask;

	private Button btnAddTask;

	private TreeView tvDAQTasks;

	private ContextMenuStrip cmsDAQTask;

	private ToolStripSeparator tsmiSpliter;

	private ToolStripMenuItem tsmiExpandAll;

	private ToolStripMenuItem tsmiCollapseAll;

	private ToolStripMenuItem tsmiAdd;

	private ToolStripMenuItem tsmiExpand;

	private ToolStripMenuItem tsmiCollapse;

	private ToolStripMenuItem tsmiEditTask;

	private ToolStripSeparator toolStripSeparator1;

	private ToolStripMenuItem tsmiDelTask;

	private Button btnUp;

	private Button btnDown;

	private Button btnMonitor;

	private ToolStripMenuItem tsmiWriteValue;

	private ToolStripMenuItem tsmiTriggerTask;

	private Button btnTaskUp;

	private Button btnTaskDown;

	/// <summary>
	///
	/// </summary>
	/// <param name="appointedStationId">指定站点</param>
	internal DAQMgrForm(Guid? appointedStationId = null)
	{
		InitializeComponent();
		pnlContainer.Enabled = false;
		btnMonitor.Visible = false;
		DEVICES = Common.GetAllDevices();
		InitStations();
		cmbStations.SelectedIndexChanged += cmbStations_SelectedIndexChanged;
		if (appointedStationId.HasValue)
		{
			cmbStations.SelectedValue = appointedStationId;
		}
	}

	private void DAQItemMgrForm_Load(object sender, EventArgs e)
	{
		ToolTip toolTip = new ToolTip();
		toolTip.AutoPopDelay = 3000;
		toolTip.InitialDelay = 500;
		toolTip.ReshowDelay = 500;
		toolTip.ShowAlways = true;
		toolTip.SetToolTip(btnAdd, "添加采集项");
		ToolTip toolTip2 = new ToolTip();
		toolTip2.AutoPopDelay = 3000;
		toolTip2.InitialDelay = 500;
		toolTip2.ReshowDelay = 500;
		toolTip2.ShowAlways = true;
		toolTip2.SetToolTip(btnDel, "删除采集项");
		ToolTip toolTip3 = new ToolTip();
		toolTip3.AutoPopDelay = 3000;
		toolTip3.InitialDelay = 500;
		toolTip3.ReshowDelay = 500;
		toolTip3.ShowAlways = true;
		toolTip3.SetToolTip(btnUp, "上移采集项");
		ToolTip toolTip4 = new ToolTip();
		toolTip4.AutoPopDelay = 3000;
		toolTip4.InitialDelay = 500;
		toolTip4.ReshowDelay = 500;
		toolTip4.ShowAlways = true;
		toolTip4.SetToolTip(btnDown, "下移采集项");
		ToolTip toolTip5 = new ToolTip();
		toolTip5.AutoPopDelay = 3000;
		toolTip5.InitialDelay = 500;
		toolTip5.ReshowDelay = 500;
		toolTip5.ShowAlways = true;
		toolTip5.SetToolTip(btnAddTask, "添加任务");
		ToolTip toolTip6 = new ToolTip();
		toolTip6.AutoPopDelay = 3000;
		toolTip6.InitialDelay = 500;
		toolTip6.ReshowDelay = 500;
		toolTip6.ShowAlways = true;
		toolTip6.SetToolTip(btnDelTask, "删除任务");
		cmbStations.Select();
		tvDAQItems.HideSelection = false;
		tvDAQItems.DrawMode = TreeViewDrawMode.OwnerDrawText;
		tvDAQItems.DrawNode += TvDAQItems_DrawNode;
		tvDAQTasks.HideSelection = false;
		tvDAQTasks.DrawMode = TreeViewDrawMode.OwnerDrawText;
		tvDAQTasks.DrawNode += TvDAQTasks_DrawNode;
	}

	/// <summary>
	/// 加载站点
	/// </summary>
	private void InitStations()
	{
		List<Station> allStations = Common.GetAllStations();
		cmbStations.DataSource = allStations;
		cmbStations.DisplayMember = "Name";
		cmbStations.ValueMember = "Id";
		cmbStations.SelectedIndex = -1;
	}

	/// <summary>
	/// 站点下拉框选择项改变时，并加载新选择的站点配置
	/// </summary>
	/// <param name="sender"></param>
	/// <param name="e"></param>
	private void cmbStations_SelectedIndexChanged(object sender, EventArgs e)
	{
		Guid stationId = new Guid(cmbStations.SelectedValue.ToString());
		InitDAQItems(stationId);
		InitDAQTasks(stationId);
		pnlContainer.Enabled = true;
		btnMonitor.Visible = true;
	}

	/// <summary>
	/// 加载此站点的采集项
	/// </summary>
	/// <param name="stationId"></param>
	private void InitDAQItems(Guid stationId)
	{
		tvDAQItems.Nodes.Clear();
		List<DAQItem> dAQItems = Common.GetDAQItems(stationId);
		foreach (DAQItem daqItem in dAQItems)
		{
			TreeNode[] array = tvDAQItems.Nodes.Find(daqItem.DeviceId.ToString(), searchAllChildren: false);
			TreeNode treeNode = null;
			if (array.Length == 0)
			{
				Device device = DEVICES.FirstOrDefault((Device t) => t.Id == daqItem.DeviceId);
				if (device == null)
				{
					throw new Exception($"未找到对应的设备信息[{daqItem.DeviceId}]");
				}
				treeNode = new TreeNode
				{
					Name = device.Id.ToString(),
					Text = device.ShowName,
					ToolTipText = device.Desc,
					Tag = device,
					ImageIndex = 0,
					SelectedImageIndex = 1
				};
				tvDAQItems.Nodes.Add(treeNode);
			}
			treeNode = tvDAQItems.Nodes.Find(daqItem.DeviceId.ToString(), searchAllChildren: false)[0];
			TreeNode node = new TreeNode
			{
				Name = daqItem.Id.ToString(),
				Text = daqItem.ShowName,
				ToolTipText = daqItem.Desc,
				Tag = daqItem,
				ImageIndex = 2,
				SelectedImageIndex = 3
			};
			treeNode.Nodes.Add(node);
		}
		tvDAQItems.ExpandAll();
	}

	/// <summary>
	/// 加载此站点的任务
	/// </summary>
	/// <param name="stationId"></param>
	private void InitDAQTasks(Guid stationId)
	{
		tvDAQTasks.Nodes.Clear();
		List<DAQTask> dAQTasks = Common.GetDAQTasks(stationId);
		foreach (DAQTask item in dAQTasks)
		{
			TreeNode node = new TreeNode
			{
				Name = item.Id.ToString(),
				Text = item.Name,
				ToolTipText = item.Desc,
				Tag = item
			};
			tvDAQTasks.Nodes.Add(node);
		}
	}

	/// <summary>
	/// treeview的选中节点在丢失焦点后仍然保持高亮
	/// </summary>
	/// <param name="sender"></param>
	/// <param name="e"></param>
	private void TvDAQItems_DrawNode(object sender, DrawTreeNodeEventArgs e)
	{
		e.DrawDefault = true;
	}

	/// <summary>
	/// treeview的选中节点在丢失焦点后仍然保持高亮
	/// </summary>
	/// <param name="sender"></param>
	/// <param name="e"></param>
	private void TvDAQTasks_DrawNode(object sender, DrawTreeNodeEventArgs e)
	{
		e.DrawDefault = true;
	}

	/// <summary>
	/// 监控采集项
	/// </summary>
	/// <param name="sender"></param>
	/// <param name="e"></param>
	private void btnMonitor_Click(object sender, EventArgs e)
	{
		ShowMonitorForm((Station)cmbStations.SelectedItem);
	}

	/// <summary>
	/// 添加采集项
	/// </summary>
	/// <param name="sender"></param>
	/// <param name="e"></param>
	private void btnAdd_Click(object sender, EventArgs e)
	{
		DAQItemEditForm dAQItemEditForm = new DAQItemEditForm((Station)cmbStations.SelectedItem, EnumFormPurpose.Add)
		{
			Icon = base.Icon,
			StartPosition = FormStartPosition.CenterParent
		};
		dAQItemEditForm.SaveDAQItem += DAQItemEditForm_AddDAQItem;
		dAQItemEditForm.ShowDialog();
	}

	/// <summary>
	/// 添加采集项-保存
	/// </summary>
	/// <param name="daqItem"></param>
	private void DAQItemEditForm_AddDAQItem(DAQItem daqItem)
	{
		XmlDocument xmlDocument = new XmlDocument();
		xmlDocument.Load(Common.CONFIG_FILE_FULL_PATH);
		XmlElement documentElement = xmlDocument.DocumentElement;
		XmlElement xmlElement = (XmlElement)documentElement.SelectSingleNode("Stations");
		bool flag = false;
		foreach (XmlNode item in xmlElement.SelectNodes("Station"))
		{
			Guid guid = new Guid(item.Attributes["Id"].Value);
			if (guid == daqItem.StationId)
			{
				XmlElement xmlElement2 = (XmlElement)item.SelectSingleNode("DAQItems");
				if (xmlElement2 == null)
				{
					xmlElement2 = xmlDocument.CreateElement("DAQItems");
					item.AppendChild(xmlElement2);
				}
				XmlElement xmlElement3 = xmlDocument.CreateElement("Item");
				xmlElement3.SetAttribute("Name", daqItem.Name);
				xmlElement3.SetAttribute("Id", daqItem.Id.ToString());
				xmlElement2.AppendChild(xmlElement3);
				XmlElement xmlElement4 = xmlDocument.CreateElement("DeviceId");
				xmlElement4.InnerText = daqItem.DeviceId.ToString();
				xmlElement3.AppendChild(xmlElement4);
				XmlElement xmlElement5 = xmlDocument.CreateElement("Identifier");
				xmlElement5.InnerText = daqItem.Identifier;
				xmlElement3.AppendChild(xmlElement5);
				XmlElement xmlElement6 = xmlDocument.CreateElement("DataType");
				xmlElement6.InnerText = daqItem.DataType;
				xmlElement3.AppendChild(xmlElement6);
				XmlElement xmlElement7 = xmlDocument.CreateElement("Desc");
				xmlElement7.InnerText = daqItem.Desc;
				xmlElement3.AppendChild(xmlElement7);
				if (daqItem.NodeId != null && !string.IsNullOrEmpty(daqItem.NodeId))
				{
					XmlElement xmlElement8 = xmlDocument.CreateElement("NodeId");
					xmlElement8.InnerText = daqItem.NodeId;
					xmlElement3.AppendChild(xmlElement8);
				}
				if (daqItem.Address != null && !string.IsNullOrEmpty(daqItem.Address))
				{
					XmlElement xmlElement9 = xmlDocument.CreateElement("Address");
					xmlElement9.InnerText = daqItem.Address;
					xmlElement3.AppendChild(xmlElement9);
				}
				if (daqItem.Length.HasValue)
				{
					XmlElement xmlElement10 = xmlDocument.CreateElement("Length");
					xmlElement10.InnerText = daqItem.Length.ToString();
					xmlElement3.AppendChild(xmlElement10);
				}
				flag = true;
				break;
			}
		}
		if (!flag)
		{
			MessageBox.Show($"未在配置文件中找到对应的站点[StationId:{daqItem.StationId}]", "异常", MessageBoxButtons.OK, MessageBoxIcon.Hand);
			return;
		}
		xmlDocument.Save(Common.CONFIG_FILE_FULL_PATH);
		TreeNode[] array = tvDAQItems.Nodes.Find(daqItem.DeviceId.ToString(), searchAllChildren: false);
		TreeNode treeNode = null;
		if (array.Length == 0)
		{
			Device device = DEVICES.FirstOrDefault((Device t) => t.Id == daqItem.DeviceId);
			treeNode = new TreeNode
			{
				Name = device.Id.ToString(),
				Text = device.ShowName,
				ToolTipText = device.Desc,
				Tag = device,
				ImageIndex = 0,
				SelectedImageIndex = 1
			};
			tvDAQItems.Nodes.Add(treeNode);
		}
		treeNode = tvDAQItems.Nodes.Find(daqItem.DeviceId.ToString(), searchAllChildren: false)[0];
		TreeNode treeNode2 = new TreeNode
		{
			Name = daqItem.Id.ToString(),
			Text = daqItem.ShowName,
			ToolTipText = daqItem.Desc,
			Tag = daqItem,
			ImageIndex = 2,
			SelectedImageIndex = 3
		};
		treeNode.Nodes.Add(treeNode2);
		tvDAQItems.SelectedNode = treeNode2;
	}

	/// <summary>
	/// 删除采集项
	/// </summary>
	/// <param name="sender"></param>
	/// <param name="e"></param>
	private void btnDel_Click(object sender, EventArgs e)
	{
		DeleteDAQItem();
	}

	/// <summary>
	/// 删除采集项
	/// </summary>
	private void DeleteDAQItem()
	{
		if (tvDAQItems.SelectedNode == null)
		{
			MessageBox.Show("请选择一个采集项", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
		}
		else
		{
			if (tvDAQItems.SelectedNode.Tag.GetType() != typeof(DAQItem))
			{
				return;
			}
			DAQItem daqItem = (DAQItem)tvDAQItems.SelectedNode.Tag;
			TreeNode selectedNode = tvDAQItems.SelectedNode;
			if (MessageBox.Show("确认删除此采集项[" + daqItem.Name + "]？\r所有相关设置都将随之失效，请谨慎操作。", "操作提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
			{
				return;
			}
			XmlDocument xmlDocument = new XmlDocument();
			xmlDocument.Load(Common.CONFIG_FILE_FULL_PATH);
			XmlElement documentElement = xmlDocument.DocumentElement;
			XmlElement xmlElement = (XmlElement)documentElement.SelectSingleNode("Stations");
			bool flag = false;
			bool flag2 = false;
			foreach (XmlNode item in xmlElement.SelectNodes("Station"))
			{
				Guid guid = new Guid(item.Attributes["Id"].Value);
				if (!(guid == daqItem.StationId))
				{
					continue;
				}
				XmlElement xmlElement2 = (XmlElement)item.SelectSingleNode("DAQItems");
				foreach (XmlNode item2 in xmlElement2.SelectNodes("Item"))
				{
					Guid guid2 = new Guid(item2.Attributes["Id"].Value);
					if (guid2 == daqItem.Id)
					{
						flag2 = true;
						xmlElement2.RemoveChild(item2);
						break;
					}
				}
				if (!flag2)
				{
					MessageBox.Show("未在配置文件中找到对应的采集项", "异常", MessageBoxButtons.OK, MessageBoxIcon.Hand);
					return;
				}
				XmlElement xmlElement3 = (XmlElement)item.SelectSingleNode("DAQTasks");
				if (xmlElement3 != null)
				{
					foreach (XmlNode item3 in xmlElement3.SelectNodes("Task"))
					{
						XmlNode xmlNode4 = item3.SelectSingleNode("Conditions");
						if (xmlNode4 != null)
						{
							foreach (XmlNode item4 in xmlNode4.SelectNodes("Condition"))
							{
								if (new Guid(item4.SelectSingleNode("DAQItemId").InnerText) == daqItem.Id)
								{
									xmlNode4.RemoveChild(item4);
								}
							}
						}
						XmlNode xmlNode6 = item3.SelectSingleNode("Params");
						if (xmlNode6 != null)
						{
							foreach (XmlNode item5 in xmlNode6.SelectNodes("Param"))
							{
								if (new Guid(item5.SelectSingleNode("DAQItemId").InnerText) == daqItem.Id)
								{
									xmlNode6.RemoveChild(item5);
								}
							}
						}
						XmlNode xmlNode8 = item3.SelectSingleNode("Writebacks");
						if (xmlNode8 == null)
						{
							continue;
						}
						foreach (XmlNode item6 in xmlNode8.SelectNodes("Writeback"))
						{
							if (new Guid(item6.SelectSingleNode("DAQItemId").InnerText) == daqItem.Id)
							{
								xmlNode8.RemoveChild(item6);
							}
						}
					}
				}
				flag = true;
				break;
			}
			if (flag)
			{
				xmlDocument.Save(Common.CONFIG_FILE_FULL_PATH);
				if (selectedNode.Parent.Nodes.Count == 1)
				{
					tvDAQItems.Nodes.Remove(selectedNode.Parent);
				}
				else
				{
					tvDAQItems.Nodes.Remove(selectedNode);
				}
				{
					foreach (TreeNode node in tvDAQTasks.Nodes)
					{
						DAQTask dAQTask = (DAQTask)node.Tag;
						dAQTask.Conditions.RemoveAll((TaskCondition t) => t.DAQItemId == daqItem.Id);
						dAQTask.Params.RemoveAll((TaskParam t) => t.DAQItemId == daqItem.Id);
						dAQTask.Writebacks.RemoveAll((TaskWriteback t) => t.DAQItemId == daqItem.Id);
					}
					return;
				}
			}
			MessageBox.Show($"未在配置文件中找到对应的站点[StationId:{daqItem.StationId}]", "异常", MessageBoxButtons.OK, MessageBoxIcon.Hand);
		}
	}

	/// <summary>
	/// 弹出编辑采集项窗体
	/// </summary>
	private void ShowEditDAQItemForm()
	{
		if (tvDAQItems.SelectedNode != null)
		{
			DAQItem daqItem = (DAQItem)tvDAQItems.SelectedNode.Tag;
			DAQItemEditForm dAQItemEditForm = new DAQItemEditForm((Station)cmbStations.SelectedItem, EnumFormPurpose.Edit, daqItem)
			{
				Icon = base.Icon,
				StartPosition = FormStartPosition.CenterParent
			};
			dAQItemEditForm.SaveDAQItem += DAQItemEditForm_EditDAQItem;
			dAQItemEditForm.ShowDialog();
		}
	}

	/// <summary>
	/// 编辑采集项-保存
	/// </summary>
	/// <param name="daqItem"></param>
	private void DAQItemEditForm_EditDAQItem(DAQItem daqItem)
	{
		XmlDocument xmlDocument = new XmlDocument();
		xmlDocument.Load(Common.CONFIG_FILE_FULL_PATH);
		XmlElement documentElement = xmlDocument.DocumentElement;
		XmlElement xmlElement = (XmlElement)documentElement.SelectSingleNode("Stations");
		bool flag = false;
		bool flag2 = false;
		foreach (XmlNode item in xmlElement.SelectNodes("Station"))
		{
			Guid guid = new Guid(item.Attributes["Id"].Value);
			if (!(guid == daqItem.StationId))
			{
				continue;
			}
			XmlElement xmlElement2 = (XmlElement)item.SelectSingleNode("DAQItems");
			foreach (XmlNode item2 in xmlElement2.SelectNodes("Item"))
			{
				Guid guid2 = new Guid(item2.Attributes["Id"].Value);
				if (guid2 == daqItem.Id)
				{
					XmlElement xmlElement3 = xmlDocument.CreateElement("Item");
					xmlElement3.SetAttribute("Name", daqItem.Name);
					xmlElement3.SetAttribute("Id", daqItem.Id.ToString());
					xmlElement2.AppendChild(xmlElement3);
					XmlElement xmlElement4 = xmlDocument.CreateElement("DeviceId");
					xmlElement4.InnerText = daqItem.DeviceId.ToString();
					xmlElement3.AppendChild(xmlElement4);
					XmlElement xmlElement5 = xmlDocument.CreateElement("Identifier");
					xmlElement5.InnerText = daqItem.Identifier;
					xmlElement3.AppendChild(xmlElement5);
					XmlElement xmlElement6 = xmlDocument.CreateElement("DataType");
					xmlElement6.InnerText = daqItem.DataType;
					xmlElement3.AppendChild(xmlElement6);
					XmlElement xmlElement7 = xmlDocument.CreateElement("Desc");
					xmlElement7.InnerText = daqItem.Desc;
					xmlElement3.AppendChild(xmlElement7);
					if (daqItem.NodeId != null && !string.IsNullOrEmpty(daqItem.NodeId))
					{
						XmlElement xmlElement8 = xmlDocument.CreateElement("NodeId");
						xmlElement8.InnerText = daqItem.NodeId;
						xmlElement3.AppendChild(xmlElement8);
					}
					if (daqItem.Address != null && !string.IsNullOrEmpty(daqItem.Address))
					{
						XmlElement xmlElement9 = xmlDocument.CreateElement("Address");
						xmlElement9.InnerText = daqItem.Address;
						xmlElement3.AppendChild(xmlElement9);
					}
					if (daqItem.Length.HasValue)
					{
						XmlElement xmlElement10 = xmlDocument.CreateElement("Length");
						xmlElement10.InnerText = daqItem.Length.ToString();
						xmlElement3.AppendChild(xmlElement10);
					}
					xmlElement2.ReplaceChild(xmlElement3, item2);
					flag2 = true;
					break;
				}
			}
			if (!flag2)
			{
				MessageBox.Show("未在配置文件中找到对应的采集项", "异常", MessageBoxButtons.OK, MessageBoxIcon.Hand);
				return;
			}
			flag = true;
			break;
		}
		if (!flag)
		{
			MessageBox.Show($"未在配置文件中找到对应的站点[StationId:{daqItem.StationId}]", "异常", MessageBoxButtons.OK, MessageBoxIcon.Hand);
			return;
		}
		xmlDocument.Save(Common.CONFIG_FILE_FULL_PATH);
		TreeNode treeNode = tvDAQItems.Nodes.Find(daqItem.Id.ToString(), searchAllChildren: true)[0];
		treeNode.Text = daqItem.ShowName;
		treeNode.ToolTipText = daqItem.Desc;
		treeNode.Tag = daqItem;
		foreach (TreeNode node in tvDAQTasks.Nodes)
		{
			DAQTask dAQTask = (DAQTask)node.Tag;
			foreach (TaskCondition item3 in dAQTask.Conditions.Where((TaskCondition t) => t.DAQItemId == daqItem.Id))
			{
				item3.DAQItem = daqItem;
			}
			foreach (TaskParam item4 in dAQTask.Params.Where((TaskParam t) => t.DAQItemId == daqItem.Id))
			{
				item4.DAQItem = daqItem;
			}
			foreach (TaskWriteback item5 in dAQTask.Writebacks.Where((TaskWriteback t) => t.DAQItemId == daqItem.Id))
			{
				item5.DAQItem = daqItem;
			}
		}
		if (daqItem.DeviceId != (treeNode.Parent.Tag as Device).Id)
		{
			TreeNode[] array = tvDAQItems.Nodes.Find(daqItem.DeviceId.ToString(), searchAllChildren: false);
			TreeNode treeNode3 = null;
			if (array.Length == 0)
			{
				Device device = DEVICES.FirstOrDefault((Device t) => t.Id == daqItem.DeviceId);
				treeNode3 = new TreeNode
				{
					Name = device.Id.ToString(),
					Text = device.ShowName,
					ToolTipText = device.Desc,
					Tag = device,
					ImageIndex = 0,
					SelectedImageIndex = 1
				};
				tvDAQItems.Nodes.Add(treeNode3);
			}
			treeNode3 = tvDAQItems.Nodes.Find(daqItem.DeviceId.ToString(), searchAllChildren: false)[0];
			if (treeNode.Parent.Nodes.Count == 1)
			{
				tvDAQItems.Nodes.Remove(treeNode.Parent);
			}
			else
			{
				tvDAQItems.Nodes.Remove(treeNode);
			}
			treeNode3.Nodes.Add(treeNode);
		}
		tvDAQItems.SelectedNode = treeNode;
	}

	/// <summary>
	/// 采集项上移
	/// </summary>
	/// <param name="sender"></param>
	/// <param name="e"></param>
	private void btnUp_Click(object sender, EventArgs e)
	{
		if (tvDAQItems.SelectedNode == null || tvDAQItems.SelectedNode.Tag.GetType() != typeof(DAQItem))
		{
			return;
		}
		TreeNode selectedNode = tvDAQItems.SelectedNode;
		TreeNode treeNode = tvDAQItems.SelectedNode.Parent;
		int index = tvDAQItems.SelectedNode.Index;
		if (index == 0)
		{
			return;
		}
		DAQItem dAQItem = (DAQItem)selectedNode.Tag;
		DAQItem dAQItem2 = (DAQItem)treeNode.Nodes[index - 1].Tag;
		XmlDocument xmlDocument = new XmlDocument();
		xmlDocument.Load(Common.CONFIG_FILE_FULL_PATH);
		XmlElement documentElement = xmlDocument.DocumentElement;
		XmlElement xmlElement = (XmlElement)documentElement.SelectSingleNode("Stations");
		bool flag = false;
		bool flag2 = false;
		bool flag3 = false;
		foreach (XmlNode item in xmlElement.SelectNodes("Station"))
		{
			if (!(new Guid(item.Attributes["Id"].Value) == dAQItem.StationId))
			{
				continue;
			}
			XmlElement xmlElement2 = (XmlElement)item.SelectSingleNode("DAQItems");
			if (xmlElement2 != null)
			{
				XmlNode newChild = null;
				XmlNode refChild = null;
				foreach (XmlNode item2 in xmlElement2.SelectNodes("Item"))
				{
					Guid guid = new Guid(item2.Attributes["Id"].Value);
					if (guid == dAQItem.Id)
					{
						newChild = item2;
						flag2 = true;
						if (flag3)
						{
							break;
						}
					}
					if (guid == dAQItem2.Id)
					{
						refChild = item2;
						flag3 = true;
						if (flag2)
						{
							break;
						}
					}
				}
				if (!flag2)
				{
					MessageBox.Show($"未在配置文件中找到对应的采集项[DAQItemId:{dAQItem.Id}]", "异常", MessageBoxButtons.OK, MessageBoxIcon.Hand);
					return;
				}
				if (!flag3)
				{
					MessageBox.Show($"未在配置文件中找到前一个采集项[DAQItemId:{dAQItem2.Id}]", "异常", MessageBoxButtons.OK, MessageBoxIcon.Hand);
					return;
				}
				xmlElement2.InsertBefore(newChild, refChild);
			}
			flag = true;
			break;
		}
		if (!flag)
		{
			throw new Exception($"未在配置文件中找到对应的站点[StationId:{dAQItem.StationId}]");
		}
		xmlDocument.Save(Common.CONFIG_FILE_FULL_PATH);
		treeNode.Nodes.Remove(selectedNode);
		treeNode.Nodes.Insert(index - 1, selectedNode);
		tvDAQItems.SelectedNode = selectedNode;
	}

	/// <summary>
	/// 采集项下移
	/// </summary>
	/// <param name="sender"></param>
	/// <param name="e"></param>
	private void btnDown_Click(object sender, EventArgs e)
	{
		if (tvDAQItems.SelectedNode == null || tvDAQItems.SelectedNode.Tag.GetType() != typeof(DAQItem))
		{
			return;
		}
		TreeNode selectedNode = tvDAQItems.SelectedNode;
		TreeNode treeNode = tvDAQItems.SelectedNode.Parent;
		int index = tvDAQItems.SelectedNode.Index;
		if (index == treeNode.Nodes.Count - 1)
		{
			return;
		}
		DAQItem dAQItem = (DAQItem)selectedNode.Tag;
		DAQItem dAQItem2 = (DAQItem)treeNode.Nodes[index + 1].Tag;
		XmlDocument xmlDocument = new XmlDocument();
		xmlDocument.Load(Common.CONFIG_FILE_FULL_PATH);
		XmlElement documentElement = xmlDocument.DocumentElement;
		XmlElement xmlElement = (XmlElement)documentElement.SelectSingleNode("Stations");
		bool flag = false;
		bool flag2 = false;
		bool flag3 = false;
		foreach (XmlNode item in xmlElement.SelectNodes("Station"))
		{
			if (!(new Guid(item.Attributes["Id"].Value) == dAQItem.StationId))
			{
				continue;
			}
			XmlElement xmlElement2 = (XmlElement)item.SelectSingleNode("DAQItems");
			if (xmlElement2 != null)
			{
				XmlNode newChild = null;
				XmlNode refChild = null;
				foreach (XmlNode item2 in xmlElement2.SelectNodes("Item"))
				{
					Guid guid = new Guid(item2.Attributes["Id"].Value);
					if (guid == dAQItem.Id)
					{
						newChild = item2;
						flag2 = true;
						if (flag3)
						{
							break;
						}
					}
					if (guid == dAQItem2.Id)
					{
						refChild = item2;
						flag3 = true;
						if (flag2)
						{
							break;
						}
					}
				}
				if (!flag2)
				{
					MessageBox.Show($"未在配置文件中找到对应的采集项[DAQItemId:{dAQItem.Id}]", "异常", MessageBoxButtons.OK, MessageBoxIcon.Hand);
					return;
				}
				if (!flag3)
				{
					MessageBox.Show($"未在配置文件中找到后一个采集项[DAQItemId:{dAQItem2.Id}]", "异常", MessageBoxButtons.OK, MessageBoxIcon.Hand);
					return;
				}
				xmlElement2.InsertAfter(newChild, refChild);
			}
			flag = true;
			break;
		}
		if (!flag)
		{
			throw new Exception($"未在配置文件中找到对应的站点[StationId:{dAQItem.StationId}]");
		}
		xmlDocument.Save(Common.CONFIG_FILE_FULL_PATH);
		treeNode.Nodes.Remove(selectedNode);
		treeNode.Nodes.Insert(index + 1, selectedNode);
		tvDAQItems.SelectedNode = selectedNode;
	}

	/// <summary>
	/// 左键双击时-编辑采集项
	/// </summary>
	/// <param name="sender"></param>
	/// <param name="e"></param>
	private void tvDAQItems_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
	{
		if (e.Button == MouseButtons.Left && tvDAQItems.SelectedNode != null && !(tvDAQItems.SelectedNode.Tag.GetType() != typeof(DAQItem)))
		{
			ShowEditDAQItemForm();
		}
	}

	/// <summary>
	/// 按下Del键时-删除采集项
	/// </summary>
	/// <param name="sender"></param>
	/// <param name="e"></param>
	private void tvDAQItems_KeyDown(object sender, KeyEventArgs e)
	{
		if (e.KeyCode == Keys.Delete)
		{
			DeleteDAQItem();
		}
	}

	/// <summary>
	/// 右键动态展示不同的菜单
	/// </summary>
	/// <param name="sender"></param>
	/// <param name="e"></param>
	private void tvDAQItems_MouseDown(object sender, MouseEventArgs e)
	{
		if (e.Button != MouseButtons.Right)
		{
			return;
		}
		tvDAQItems.ContextMenuStrip = cmsDAQItem;
		Point pt = new Point(e.X, e.Y);
		TreeNode nodeAt = tvDAQItems.GetNodeAt(pt);
		if (nodeAt != null)
		{
			tvDAQItems.SelectedNode = nodeAt;
			tsmiExpandAll.Visible = false;
			tsmiCollapseAll.Visible = false;
			if (nodeAt.Tag.GetType() == typeof(DAQItem))
			{
				tsmiAdd.Visible = false;
				tsmiEdit.Visible = true;
				tsmiDel.Visible = true;
				tsmiWriteValue.Visible = true;
				tsmiSpliter.Visible = false;
				tsmiExpand.Visible = false;
				tsmiCollapse.Visible = false;
			}
			else if (nodeAt.Tag.GetType() == typeof(Device))
			{
				tsmiAdd.Visible = true;
				tsmiEdit.Visible = false;
				tsmiDel.Visible = false;
				tsmiWriteValue.Visible = false;
				tsmiSpliter.Visible = true;
				if (tvDAQItems.SelectedNode.IsExpanded)
				{
					tsmiExpand.Visible = false;
					tsmiCollapse.Visible = true;
				}
				else
				{
					tsmiExpand.Visible = true;
					tsmiCollapse.Visible = false;
				}
			}
		}
		else
		{
			tsmiAdd.Visible = false;
			tsmiEdit.Visible = false;
			tsmiDel.Visible = false;
			tsmiWriteValue.Visible = false;
			tsmiSpliter.Visible = false;
			tsmiExpandAll.Visible = true;
			tsmiCollapseAll.Visible = true;
			tsmiExpand.Visible = false;
			tsmiCollapse.Visible = false;
			tvDAQItems.SelectedNode = null;
		}
	}

	/// <summary>
	/// 添加采集项
	/// </summary>
	/// <param name="sender"></param>
	/// <param name="e"></param>
	private void tsmiAdd_Click(object sender, EventArgs e)
	{
		Guid id = (tvDAQItems.SelectedNode.Tag as Device).Id;
		DAQItemEditForm dAQItemEditForm = new DAQItemEditForm((Station)cmbStations.SelectedItem, EnumFormPurpose.Add, null, id)
		{
			Icon = base.Icon,
			StartPosition = FormStartPosition.CenterParent
		};
		dAQItemEditForm.SaveDAQItem += DAQItemEditForm_AddDAQItem;
		dAQItemEditForm.ShowDialog();
	}

	/// <summary>
	/// 编辑采集项
	/// </summary>
	/// <param name="sender"></param>
	/// <param name="e"></param>
	private void tsmiEdit_Click(object sender, EventArgs e)
	{
		ShowEditDAQItemForm();
	}

	/// <summary>
	/// 删除采集项
	/// </summary>
	/// <param name="sender"></param>
	/// <param name="e"></param>
	private void tsmiDel_Click(object sender, EventArgs e)
	{
		DeleteDAQItem();
	}

	/// <summary>
	/// 写入值
	/// </summary>
	/// <param name="sender"></param>
	/// <param name="e"></param>
	private void tsmiWriteValue_Click(object sender, EventArgs e)
	{
		Device device = (Device)tvDAQItems.SelectedNode.Parent.Tag;
		DAQItem daqItem = (DAQItem)tvDAQItems.SelectedNode.Tag;
		WriteValueForm writeValueForm = new WriteValueForm(device, daqItem)
		{
			Icon = base.Icon,
			StartPosition = FormStartPosition.CenterParent
		};
		writeValueForm.ShowDialog();
	}

	/// <summary>
	/// 展开节点
	/// </summary>
	/// <param name="sender"></param>
	/// <param name="e"></param>
	private void tsmiExpand_Click(object sender, EventArgs e)
	{
		tvDAQItems.SelectedNode.Expand();
	}

	/// <summary>
	/// 折叠节点
	/// </summary>
	/// <param name="sender"></param>
	/// <param name="e"></param>
	private void tsmiCollapse_Click(object sender, EventArgs e)
	{
		tvDAQItems.SelectedNode.Collapse();
	}

	/// <summary>
	/// 展开全部节点
	/// </summary>
	/// <param name="sender"></param>
	/// <param name="e"></param>
	private void tsmiExpandAll_Click(object sender, EventArgs e)
	{
		tvDAQItems.ExpandAll();
	}

	/// <summary>
	/// 折叠全部节点
	/// </summary>
	/// <param name="sender"></param>
	/// <param name="e"></param>
	private void tsmiCollapseAll_Click(object sender, EventArgs e)
	{
		tvDAQItems.CollapseAll();
	}

	/// <summary>
	/// 添加任务
	/// </summary>
	/// <param name="sender"></param>
	/// <param name="e"></param>
	private void btnAddTask_Click(object sender, EventArgs e)
	{
		DAQTaskEditForm dAQTaskEditForm = new DAQTaskEditForm((Station)cmbStations.SelectedItem, EnumFormPurpose.Add)
		{
			Icon = base.Icon,
			StartPosition = FormStartPosition.CenterParent
		};
		dAQTaskEditForm.SaveDAQTask += DAQTaskEditForm_AddDAQItem;
		dAQTaskEditForm.ShowDialog();
	}

	/// <summary>
	/// 添加任务-保存
	/// </summary>
	/// <param name="daqTask"></param>
	private void DAQTaskEditForm_AddDAQItem(DAQTask daqTask)
	{
		XmlDocument xmlDocument = new XmlDocument();
		xmlDocument.Load(Common.CONFIG_FILE_FULL_PATH);
		XmlElement documentElement = xmlDocument.DocumentElement;
		XmlElement xmlElement = (XmlElement)documentElement.SelectSingleNode("Stations");
		bool flag = false;
		foreach (XmlNode item in xmlElement.SelectNodes("Station"))
		{
			Guid guid = new Guid(item.Attributes["Id"].Value);
			if (!(guid == daqTask.StationId))
			{
				continue;
			}
			XmlElement xmlElement2 = (XmlElement)item.SelectSingleNode("DAQTasks");
			if (xmlElement2 == null)
			{
				xmlElement2 = xmlDocument.CreateElement("DAQTasks");
				item.AppendChild(xmlElement2);
			}
			XmlElement xmlElement3 = xmlDocument.CreateElement("Task");
			xmlElement3.SetAttribute("Name", daqTask.Name);
			xmlElement3.SetAttribute("Id", daqTask.Id.ToString());
			xmlElement2.AppendChild(xmlElement3);
			XmlElement xmlElement4 = xmlDocument.CreateElement("Launch");
			xmlElement4.InnerText = daqTask.Launch.ToString();
			xmlElement3.AppendChild(xmlElement4);
			XmlElement xmlElement5 = xmlDocument.CreateElement("NeedLog");
			xmlElement5.InnerText = daqTask.NeedLog.ToString();
			xmlElement3.AppendChild(xmlElement5);
			XmlElement xmlElement6 = xmlDocument.CreateElement("TriggerMode");
			xmlElement6.InnerText = daqTask.TriggerMode.ToString();
			xmlElement3.AppendChild(xmlElement6);
			if (daqTask.Interval.HasValue)
			{
				XmlElement xmlElement7 = xmlDocument.CreateElement("Interval");
				xmlElement7.InnerText = daqTask.Interval.ToString();
				xmlElement3.AppendChild(xmlElement7);
			}
			if (daqTask.SocketServerId.HasValue)
			{
				XmlElement xmlElement8 = xmlDocument.CreateElement("SocketServerId");
				xmlElement8.InnerText = daqTask.SocketServerId.ToString();
				xmlElement3.AppendChild(xmlElement8);
			}
			XmlElement xmlElement9 = xmlDocument.CreateElement("Desc");
			xmlElement9.InnerText = daqTask.Desc;
			xmlElement3.AppendChild(xmlElement9);
			XmlElement xmlElement10 = xmlDocument.CreateElement("MultiConditionStrategy");
			xmlElement10.InnerText = daqTask.MultiConditionStrategy.ToString();
			xmlElement3.AppendChild(xmlElement10);
			XmlElement xmlElement11 = xmlDocument.CreateElement("Namespace");
			xmlElement11.InnerText = daqTask.Namespace;
			xmlElement3.AppendChild(xmlElement11);
			XmlElement xmlElement12 = xmlDocument.CreateElement("ClassName");
			xmlElement12.InnerText = daqTask.ClassName;
			xmlElement3.AppendChild(xmlElement12);
			XmlElement xmlElement13 = xmlDocument.CreateElement("MethodName");
			xmlElement13.InnerText = daqTask.MethodName;
			xmlElement3.AppendChild(xmlElement13);
			XmlElement xmlElement14 = xmlDocument.CreateElement("Conditions");
			xmlElement3.AppendChild(xmlElement14);
			foreach (TaskCondition condition in daqTask.Conditions)
			{
				XmlElement xmlElement15 = xmlDocument.CreateElement("Condition");
				xmlElement15.SetAttribute("Id", condition.Id.ToString());
				xmlElement14.AppendChild(xmlElement15);
				XmlElement xmlElement16 = xmlDocument.CreateElement("DAQItemId");
				xmlElement16.InnerText = condition.DAQItemId.ToString();
				xmlElement15.AppendChild(xmlElement16);
				XmlElement xmlElement17 = xmlDocument.CreateElement("Operator");
				xmlElement17.InnerText = condition.Operator;
				xmlElement15.AppendChild(xmlElement17);
				XmlElement xmlElement18 = xmlDocument.CreateElement("Value");
				xmlElement18.InnerText = condition.Value.ToString();
				xmlElement15.AppendChild(xmlElement18);
			}
			XmlElement xmlElement19 = xmlDocument.CreateElement("Params");
			xmlElement3.AppendChild(xmlElement19);
			foreach (TaskParam param in daqTask.Params)
			{
				XmlElement xmlElement20 = xmlDocument.CreateElement("Param");
				xmlElement20.SetAttribute("Id", param.Id.ToString());
				xmlElement19.AppendChild(xmlElement20);
				XmlElement xmlElement21 = xmlDocument.CreateElement("DAQItemId");
				xmlElement21.InnerText = param.DAQItemId.ToString();
				xmlElement20.AppendChild(xmlElement21);
				XmlElement xmlElement22 = xmlDocument.CreateElement("IsConst");
				xmlElement22.InnerText = param.IsConst.ToString();
				xmlElement22.SetAttribute("Const", param.Const);
				xmlElement20.AppendChild(xmlElement22);
				XmlElement xmlElement23 = xmlDocument.CreateElement("SingleRead");
				xmlElement23.InnerText = param.SingleRead.ToString();
				xmlElement23.SetAttribute("DefaultValue", param.DefaultValue);
				xmlElement20.AppendChild(xmlElement23);
			}
			XmlElement xmlElement24 = xmlDocument.CreateElement("SocketParam");
			xmlElement24.SetAttribute("AsParam", daqTask.SocketMsgAsParam.ToString());
			xmlElement3.AppendChild(xmlElement24);
			XmlElement xmlElement25 = xmlDocument.CreateElement("Identifier");
			xmlElement25.InnerText = daqTask.SocketMsgIdentifier.ToString();
			xmlElement24.AppendChild(xmlElement25);
			XmlElement xmlElement26 = xmlDocument.CreateElement("Writebacks");
			xmlElement3.AppendChild(xmlElement26);
			foreach (TaskWriteback writeback in daqTask.Writebacks)
			{
				XmlElement xmlElement27 = xmlDocument.CreateElement("Writeback");
				xmlElement27.SetAttribute("Id", writeback.Id.ToString());
				xmlElement26.AppendChild(xmlElement27);
				XmlElement xmlElement28 = xmlDocument.CreateElement("DAQItemId");
				xmlElement28.InnerText = writeback.DAQItemId.ToString();
				xmlElement27.AppendChild(xmlElement28);
				XmlElement xmlElement29 = xmlDocument.CreateElement("Content");
				xmlElement29.InnerText = writeback.Content.ToString();
				xmlElement27.AppendChild(xmlElement29);
				XmlElement xmlElement30 = xmlDocument.CreateElement("ContentSource");
				xmlElement30.InnerText = writeback.ContentSource;
				xmlElement27.AppendChild(xmlElement30);
			}
			XmlElement xmlElement31 = xmlDocument.CreateElement("SocketWriteback");
			xmlElement31.SetAttribute("Writeback", daqTask.WritebackSocketMsg.ToString());
			xmlElement3.AppendChild(xmlElement31);
			XmlElement xmlElement32 = xmlDocument.CreateElement("Content");
			xmlElement32.InnerText = daqTask.SocketMsgWritebackContent;
			xmlElement31.AppendChild(xmlElement32);
			XmlElement xmlElement33 = xmlDocument.CreateElement("ContentSource");
			xmlElement33.InnerText = daqTask.SocketMsgWritebackSource;
			xmlElement31.AppendChild(xmlElement33);
			XmlElement xmlElement34 = xmlDocument.CreateElement("IsString");
			xmlElement34.InnerText = daqTask.SocketMsgWritebackIsString.ToString();
			xmlElement31.AppendChild(xmlElement34);
			flag = true;
			break;
		}
		if (!flag)
		{
			MessageBox.Show($"未在配置文件中找到对应的站点[StationId:{daqTask.StationId}]", "异常", MessageBoxButtons.OK, MessageBoxIcon.Hand);
			return;
		}
		xmlDocument.Save(Common.CONFIG_FILE_FULL_PATH);
		TreeNode treeNode = new TreeNode
		{
			Name = daqTask.Id.ToString(),
			Text = daqTask.Name,
			ToolTipText = daqTask.Desc,
			Tag = daqTask
		};
		tvDAQTasks.Nodes.Add(treeNode);
		tvDAQTasks.SelectedNode = treeNode;
	}

	/// <summary>
	/// 删除任务
	/// </summary>
	/// <param name="sender"></param>
	/// <param name="e"></param>
	private void btnDelTask_Click(object sender, EventArgs e)
	{
		DeleteDAQTask();
	}

	/// <summary>
	/// 删除任务
	/// </summary>
	private void DeleteDAQTask()
	{
		if (tvDAQTasks.SelectedNode == null)
		{
			MessageBox.Show("请选择一个任务", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
			return;
		}
		DAQTask dAQTask = (DAQTask)tvDAQTasks.SelectedNode.Tag;
		if (MessageBox.Show("确认删除此任务[" + dAQTask.Name + "]？", "操作提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
		{
			return;
		}
		XmlDocument xmlDocument = new XmlDocument();
		xmlDocument.Load(Common.CONFIG_FILE_FULL_PATH);
		XmlElement documentElement = xmlDocument.DocumentElement;
		XmlElement xmlElement = (XmlElement)documentElement.SelectSingleNode("Stations");
		bool flag = false;
		bool flag2 = false;
		foreach (XmlNode item in xmlElement.SelectNodes("Station"))
		{
			Guid guid = new Guid(item.Attributes["Id"].Value);
			if (!(guid == dAQTask.StationId))
			{
				continue;
			}
			XmlElement xmlElement2 = (XmlElement)item.SelectSingleNode("DAQTasks");
			foreach (XmlNode item2 in xmlElement2.SelectNodes("Task"))
			{
				Guid guid2 = new Guid(item2.Attributes["Id"].Value);
				if (guid2 == dAQTask.Id)
				{
					flag2 = true;
					xmlElement2.RemoveChild(item2);
					break;
				}
			}
			if (!flag2)
			{
				MessageBox.Show("未在配置文件中找到对应的任务", "异常", MessageBoxButtons.OK, MessageBoxIcon.Hand);
				return;
			}
			flag = true;
			break;
		}
		if (!flag)
		{
			MessageBox.Show($"未在配置文件中找到对应的站点[StationId:{dAQTask.StationId}]", "异常", MessageBoxButtons.OK, MessageBoxIcon.Hand);
			return;
		}
		xmlDocument.Save(Common.CONFIG_FILE_FULL_PATH);
		tvDAQTasks.Nodes.Remove(tvDAQTasks.SelectedNode);
	}

	/// <summary>
	/// 弹出编辑任务窗体
	/// </summary>
	private void ShowEditDAQTaskForm()
	{
		if (tvDAQTasks.SelectedNode != null)
		{
			DAQTask daqTask = (DAQTask)tvDAQTasks.SelectedNode.Tag;
			DAQTaskEditForm dAQTaskEditForm = new DAQTaskEditForm((Station)cmbStations.SelectedItem, EnumFormPurpose.Edit, daqTask)
			{
				Icon = base.Icon,
				StartPosition = FormStartPosition.CenterParent
			};
			dAQTaskEditForm.SaveDAQTask += EditDAQTaskForm_EditDAQTask;
			dAQTaskEditForm.ShowDialog();
		}
	}

	/// <summary>
	/// 编辑任务-保存
	/// </summary>
	/// <param name="daqTask"></param>
	private void EditDAQTaskForm_EditDAQTask(DAQTask daqTask)
	{
		XmlDocument xmlDocument = new XmlDocument();
		xmlDocument.Load(Common.CONFIG_FILE_FULL_PATH);
		XmlElement documentElement = xmlDocument.DocumentElement;
		XmlElement xmlElement = (XmlElement)documentElement.SelectSingleNode("Stations");
		bool flag = false;
		bool flag2 = false;
		foreach (XmlNode item in xmlElement.SelectNodes("Station"))
		{
			Guid guid = new Guid(item.Attributes["Id"].Value);
			if (!(guid == daqTask.StationId))
			{
				continue;
			}
			XmlElement xmlElement2 = (XmlElement)item.SelectSingleNode("DAQTasks");
			foreach (XmlNode item2 in xmlElement2.SelectNodes("Task"))
			{
				Guid guid2 = new Guid(item2.Attributes["Id"].Value);
				if (!(guid2 == daqTask.Id))
				{
					continue;
				}
				XmlElement xmlElement3 = xmlDocument.CreateElement("Task");
				xmlElement3.SetAttribute("Name", daqTask.Name);
				xmlElement3.SetAttribute("Id", daqTask.Id.ToString());
				xmlElement2.AppendChild(xmlElement3);
				XmlElement xmlElement4 = xmlDocument.CreateElement("Launch");
				xmlElement4.InnerText = daqTask.Launch.ToString();
				xmlElement3.AppendChild(xmlElement4);
				XmlElement xmlElement5 = xmlDocument.CreateElement("NeedLog");
				xmlElement5.InnerText = daqTask.NeedLog.ToString();
				xmlElement3.AppendChild(xmlElement5);
				XmlElement xmlElement6 = xmlDocument.CreateElement("TriggerMode");
				xmlElement6.InnerText = daqTask.TriggerMode.ToString();
				xmlElement3.AppendChild(xmlElement6);
				if (daqTask.Interval.HasValue)
				{
					XmlElement xmlElement7 = xmlDocument.CreateElement("Interval");
					xmlElement7.InnerText = daqTask.Interval.ToString();
					xmlElement3.AppendChild(xmlElement7);
				}
				if (daqTask.SocketServerId.HasValue)
				{
					XmlElement xmlElement8 = xmlDocument.CreateElement("SocketServerId");
					xmlElement8.InnerText = daqTask.SocketServerId.ToString();
					xmlElement3.AppendChild(xmlElement8);
				}
				XmlElement xmlElement9 = xmlDocument.CreateElement("Desc");
				xmlElement9.InnerText = daqTask.Desc;
				xmlElement3.AppendChild(xmlElement9);
				XmlElement xmlElement10 = xmlDocument.CreateElement("MultiConditionStrategy");
				xmlElement10.InnerText = daqTask.MultiConditionStrategy.ToString();
				xmlElement3.AppendChild(xmlElement10);
				XmlElement xmlElement11 = xmlDocument.CreateElement("Namespace");
				xmlElement11.InnerText = daqTask.Namespace;
				xmlElement3.AppendChild(xmlElement11);
				XmlElement xmlElement12 = xmlDocument.CreateElement("ClassName");
				xmlElement12.InnerText = daqTask.ClassName;
				xmlElement3.AppendChild(xmlElement12);
				XmlElement xmlElement13 = xmlDocument.CreateElement("MethodName");
				xmlElement13.InnerText = daqTask.MethodName;
				xmlElement3.AppendChild(xmlElement13);
				XmlElement xmlElement14 = xmlDocument.CreateElement("Conditions");
				xmlElement3.AppendChild(xmlElement14);
				foreach (TaskCondition condition in daqTask.Conditions)
				{
					XmlElement xmlElement15 = xmlDocument.CreateElement("Condition");
					xmlElement15.SetAttribute("Id", condition.Id.ToString());
					xmlElement14.AppendChild(xmlElement15);
					XmlElement xmlElement16 = xmlDocument.CreateElement("DAQItemId");
					xmlElement16.InnerText = condition.DAQItemId.ToString();
					xmlElement15.AppendChild(xmlElement16);
					XmlElement xmlElement17 = xmlDocument.CreateElement("Operator");
					xmlElement17.InnerText = condition.Operator;
					xmlElement15.AppendChild(xmlElement17);
					XmlElement xmlElement18 = xmlDocument.CreateElement("Value");
					xmlElement18.InnerText = condition.Value.ToString();
					xmlElement15.AppendChild(xmlElement18);
				}
				XmlElement xmlElement19 = xmlDocument.CreateElement("Params");
				xmlElement3.AppendChild(xmlElement19);
				foreach (TaskParam param in daqTask.Params)
				{
					XmlElement xmlElement20 = xmlDocument.CreateElement("Param");
					xmlElement20.SetAttribute("Id", param.Id.ToString());
					xmlElement19.AppendChild(xmlElement20);
					XmlElement xmlElement21 = xmlDocument.CreateElement("DAQItemId");
					xmlElement21.InnerText = param.DAQItemId.ToString();
					xmlElement20.AppendChild(xmlElement21);
					XmlElement xmlElement22 = xmlDocument.CreateElement("IsConst");
					xmlElement22.InnerText = param.IsConst.ToString();
					xmlElement22.SetAttribute("Const", param.Const);
					xmlElement20.AppendChild(xmlElement22);
					XmlElement xmlElement23 = xmlDocument.CreateElement("SingleRead");
					xmlElement23.InnerText = param.SingleRead.ToString();
					xmlElement23.SetAttribute("DefaultValue", param.DefaultValue);
					xmlElement20.AppendChild(xmlElement23);
				}
				XmlElement xmlElement24 = xmlDocument.CreateElement("SocketParam");
				xmlElement24.SetAttribute("AsParam", daqTask.SocketMsgAsParam.ToString());
				xmlElement3.AppendChild(xmlElement24);
				XmlElement xmlElement25 = xmlDocument.CreateElement("Identifier");
				xmlElement25.InnerText = daqTask.SocketMsgIdentifier.ToString();
				xmlElement24.AppendChild(xmlElement25);
				XmlElement xmlElement26 = xmlDocument.CreateElement("Writebacks");
				xmlElement3.AppendChild(xmlElement26);
				foreach (TaskWriteback writeback in daqTask.Writebacks)
				{
					XmlElement xmlElement27 = xmlDocument.CreateElement("Writeback");
					xmlElement27.SetAttribute("Id", writeback.Id.ToString());
					xmlElement26.AppendChild(xmlElement27);
					XmlElement xmlElement28 = xmlDocument.CreateElement("DAQItemId");
					xmlElement28.InnerText = writeback.DAQItemId.ToString();
					xmlElement27.AppendChild(xmlElement28);
					XmlElement xmlElement29 = xmlDocument.CreateElement("Content");
					xmlElement29.InnerText = writeback.Content.ToString();
					xmlElement27.AppendChild(xmlElement29);
					XmlElement xmlElement30 = xmlDocument.CreateElement("ContentSource");
					xmlElement30.InnerText = writeback.ContentSource;
					xmlElement27.AppendChild(xmlElement30);
				}
				XmlElement xmlElement31 = xmlDocument.CreateElement("SocketWriteback");
				xmlElement31.SetAttribute("Writeback", daqTask.WritebackSocketMsg.ToString());
				xmlElement3.AppendChild(xmlElement31);
				XmlElement xmlElement32 = xmlDocument.CreateElement("Content");
				xmlElement32.InnerText = daqTask.SocketMsgWritebackContent;
				xmlElement31.AppendChild(xmlElement32);
				XmlElement xmlElement33 = xmlDocument.CreateElement("ContentSource");
				xmlElement33.InnerText = daqTask.SocketMsgWritebackSource;
				xmlElement31.AppendChild(xmlElement33);
				XmlElement xmlElement34 = xmlDocument.CreateElement("IsString");
				xmlElement34.InnerText = daqTask.SocketMsgWritebackIsString.ToString();
				xmlElement31.AppendChild(xmlElement34);
				xmlElement2.ReplaceChild(xmlElement3, item2);
				flag2 = true;
				break;
			}
			if (!flag2)
			{
				MessageBox.Show("未在配置文件中找到对应的任务", "异常", MessageBoxButtons.OK, MessageBoxIcon.Hand);
				return;
			}
			flag = true;
			break;
		}
		if (!flag)
		{
			MessageBox.Show($"未在配置文件中找到对应的站点[StationId:{daqTask.StationId}]", "异常", MessageBoxButtons.OK, MessageBoxIcon.Hand);
			return;
		}
		xmlDocument.Save(Common.CONFIG_FILE_FULL_PATH);
		TreeNode treeNode = tvDAQTasks.Nodes.Find(daqTask.Id.ToString(), searchAllChildren: true)[0];
		treeNode.Text = daqTask.Name;
		treeNode.ToolTipText = daqTask.Desc;
		treeNode.Tag = daqTask;
		tvDAQItems.SelectedNode = treeNode;
	}

	/// <summary>
	/// 任务上移
	/// </summary>
	/// <param name="sender"></param>
	/// <param name="e"></param>
	private void btnTaskUp_Click(object sender, EventArgs e)
	{
		if (tvDAQTasks.SelectedNode == null)
		{
			return;
		}
		TreeNode selectedNode = tvDAQTasks.SelectedNode;
		int index = tvDAQTasks.SelectedNode.Index;
		if (index == 0)
		{
			return;
		}
		DAQTask dAQTask = (DAQTask)selectedNode.Tag;
		DAQTask dAQTask2 = (DAQTask)tvDAQTasks.Nodes[index - 1].Tag;
		XmlDocument xmlDocument = new XmlDocument();
		xmlDocument.Load(Common.CONFIG_FILE_FULL_PATH);
		XmlElement documentElement = xmlDocument.DocumentElement;
		XmlElement xmlElement = (XmlElement)documentElement.SelectSingleNode("Stations");
		bool flag = false;
		bool flag2 = false;
		bool flag3 = false;
		foreach (XmlNode item in xmlElement.SelectNodes("Station"))
		{
			if (!(new Guid(item.Attributes["Id"].Value) == dAQTask.StationId))
			{
				continue;
			}
			XmlElement xmlElement2 = (XmlElement)item.SelectSingleNode("DAQTasks");
			if (xmlElement2 != null)
			{
				XmlNode newChild = null;
				XmlNode refChild = null;
				foreach (XmlNode item2 in xmlElement2.SelectNodes("Task"))
				{
					Guid guid = new Guid(item2.Attributes["Id"].Value);
					if (guid == dAQTask.Id)
					{
						newChild = item2;
						flag2 = true;
						if (flag3)
						{
							break;
						}
					}
					if (guid == dAQTask2.Id)
					{
						refChild = item2;
						flag3 = true;
						if (flag2)
						{
							break;
						}
					}
				}
				if (!flag2)
				{
					MessageBox.Show($"未在配置文件中找到对应的任务[DAQTaskId:{dAQTask.Id}]", "异常", MessageBoxButtons.OK, MessageBoxIcon.Hand);
					return;
				}
				if (!flag3)
				{
					MessageBox.Show($"未在配置文件中找到前一个任务[DAQTaskId:{dAQTask2.Id}]", "异常", MessageBoxButtons.OK, MessageBoxIcon.Hand);
					return;
				}
				xmlElement2.InsertBefore(newChild, refChild);
			}
			flag = true;
			break;
		}
		if (!flag)
		{
			throw new Exception($"未在配置文件中找到对应的站点[StationId:{dAQTask.StationId}]");
		}
		xmlDocument.Save(Common.CONFIG_FILE_FULL_PATH);
		tvDAQTasks.Nodes.Remove(selectedNode);
		tvDAQTasks.Nodes.Insert(index - 1, selectedNode);
		tvDAQTasks.SelectedNode = selectedNode;
	}

	/// <summary>
	/// 任务下移
	/// </summary>
	/// <param name="sender"></param>
	/// <param name="e"></param>
	private void btnTaskDown_Click(object sender, EventArgs e)
	{
		if (tvDAQTasks.SelectedNode == null)
		{
			return;
		}
		TreeNode selectedNode = tvDAQTasks.SelectedNode;
		int index = tvDAQTasks.SelectedNode.Index;
		if (index == tvDAQTasks.Nodes.Count - 1)
		{
			return;
		}
		DAQTask dAQTask = (DAQTask)selectedNode.Tag;
		DAQTask dAQTask2 = (DAQTask)tvDAQTasks.Nodes[index + 1].Tag;
		XmlDocument xmlDocument = new XmlDocument();
		xmlDocument.Load(Common.CONFIG_FILE_FULL_PATH);
		XmlElement documentElement = xmlDocument.DocumentElement;
		XmlElement xmlElement = (XmlElement)documentElement.SelectSingleNode("Stations");
		bool flag = false;
		bool flag2 = false;
		bool flag3 = false;
		foreach (XmlNode item in xmlElement.SelectNodes("Station"))
		{
			if (!(new Guid(item.Attributes["Id"].Value) == dAQTask.StationId))
			{
				continue;
			}
			XmlElement xmlElement2 = (XmlElement)item.SelectSingleNode("DAQTasks");
			if (xmlElement2 != null)
			{
				XmlNode newChild = null;
				XmlNode refChild = null;
				foreach (XmlNode item2 in xmlElement2.SelectNodes("Task"))
				{
					Guid guid = new Guid(item2.Attributes["Id"].Value);
					if (guid == dAQTask.Id)
					{
						newChild = item2;
						flag2 = true;
						if (flag3)
						{
							break;
						}
					}
					if (guid == dAQTask2.Id)
					{
						refChild = item2;
						flag3 = true;
						if (flag2)
						{
							break;
						}
					}
				}
				if (!flag2)
				{
					MessageBox.Show($"未在配置文件中找到对应的任务[DAQTaskId:{dAQTask.Id}]", "异常", MessageBoxButtons.OK, MessageBoxIcon.Hand);
					return;
				}
				if (!flag3)
				{
					MessageBox.Show($"未在配置文件中找到后一个任务[DAQTaskId:{dAQTask2.Id}]", "异常", MessageBoxButtons.OK, MessageBoxIcon.Hand);
					return;
				}
				xmlElement2.InsertAfter(newChild, refChild);
			}
			flag = true;
			break;
		}
		if (!flag)
		{
			throw new Exception($"未在配置文件中找到对应的站点[StationId:{dAQTask.StationId}]");
		}
		xmlDocument.Save(Common.CONFIG_FILE_FULL_PATH);
		tvDAQTasks.Nodes.Remove(selectedNode);
		tvDAQTasks.Nodes.Insert(index + 1, selectedNode);
		tvDAQTasks.SelectedNode = selectedNode;
	}

	/// <summary>
	/// 仅在右键单击Node时展开菜单
	/// </summary>
	/// <param name="sender"></param>
	/// <param name="e"></param>
	private void tvDAQTasks_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
	{
		Point pt = new Point(e.X, e.Y);
		TreeNode nodeAt = tvDAQTasks.GetNodeAt(pt);
		if (nodeAt != null && e.Button == MouseButtons.Right)
		{
			tvDAQTasks.SelectedNode = nodeAt;
			tvDAQTasks.SelectedNode.ContextMenuStrip = cmsDAQTask;
		}
	}

	/// <summary>
	/// 左键双击时-编辑任务
	/// </summary>
	/// <param name="sender"></param>
	/// <param name="e"></param>
	private void tvDAQTasks_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
	{
		if (e.Button == MouseButtons.Left)
		{
			ShowEditDAQTaskForm();
		}
	}

	/// <summary>
	/// 按下Del键时-删除任务
	/// </summary>
	/// <param name="sender"></param>
	/// <param name="e"></param>
	private void tvDAQTasks_KeyDown(object sender, KeyEventArgs e)
	{
		if (e.KeyCode == Keys.Delete)
		{
			DeleteDAQTask();
		}
	}

	/// <summary>
	/// Edit DAQTask
	/// </summary>
	/// <param name="sender"></param>
	/// <param name="e"></param>
	private void tsmiEditTask_Click(object sender, EventArgs e)
	{
		ShowEditDAQTaskForm();
	}

	/// <summary>
	/// Delete Station
	/// </summary>
	/// <param name="sender"></param>
	/// <param name="e"></param>
	private void tsmiDelTask_Click(object sender, EventArgs e)
	{
		DeleteDAQTask();
	}

	/// <summary>
	/// 手动触发任务（忽略触发条件）
	/// </summary>
	/// <param name="sender"></param>
	/// <param name="e"></param>
	private async void tsmiTriggerTask_Click(object sender, EventArgs e)
	{
		if (tvDAQTasks.SelectedNode == null)
		{
			return;
		}
		Station station = (Station)cmbStations.SelectedItem;
		DAQTask task = (DAQTask)tvDAQTasks.SelectedNode.Tag;
		List<Connection> connectionPool = new List<Connection>();
		List<Guid> deviceIds = new List<Guid>();
		deviceIds.AddRange(from t in task.Params
			where !t.IsConst
			select t.DAQItem.DeviceId);
		deviceIds.AddRange(task.Writebacks.Select((TaskWriteback t) => t.DAQItem.DeviceId));
		if (task.WritebackSocketMsg)
		{
			deviceIds.Add(task.SocketServerId.Value);
		}
		List<Device> devices = (from t in deviceIds.Distinct()
			select Common.GetDevice(t)).ToList();
		foreach (Device device in devices)
		{
			switch (device.Protocol)
			{
			case EnumProtocol.OPCUA:
			{
				OpcUaClient opcuaConnection;
				if (connectionPool.Any((Connection t) => t.DeviceId == device.Id && t.ConnectionIns.GetType() == typeof(OpcUaClient)))
				{
					opcuaConnection = (OpcUaClient)connectionPool.FirstOrDefault((Connection t) => t.DeviceId == device.Id && t.ConnectionIns.GetType() == typeof(OpcUaClient)).ConnectionIns;
				}
				else
				{
					opcuaConnection = new OpcUaClient();
					connectionPool.Add(new Connection
					{
						DeviceId = device.Id,
						Protocol = EnumProtocol.OPCUA,
						ConnectionIns = opcuaConnection
					});
				}
				if (device.NeedAccount.HasValue && device.NeedAccount.Value)
				{
					opcuaConnection.UserIdentity = new UserIdentity(device.Account, device.Pwd);
				}
				try
				{
					if (!opcuaConnection.Connected)
					{
						await opcuaConnection.ConnectServer(device.Url);
					}
				}
				catch (Exception ex)
				{
					MessageBox.Show("启动失败！\r设备[" + device.ShowName + "]连接失败：" + ex.Message, "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
					return;
				}
				break;
			}
			case EnumProtocol.S7:
			{
				SiemensS7Net s7Connection;
				if (connectionPool.Any((Connection t) => t.DeviceId == device.Id && t.ConnectionIns.GetType() == typeof(SiemensS7Net)))
				{
					s7Connection = (SiemensS7Net)connectionPool.FirstOrDefault((Connection t) => t.DeviceId == device.Id && t.ConnectionIns.GetType() == typeof(SiemensS7Net)).ConnectionIns;
				}
				else
				{
					s7Connection = new SiemensS7Net((SiemensPLCS)device.Model)
					{
						IpAddress = device.IP,
						Port = device.Port,
						Rack = Convert.ToByte(device.Rack),
						Slot = Convert.ToByte(device.Slot)
					};
					connectionPool.Add(new Connection
					{
						DeviceId = device.Id,
						Protocol = EnumProtocol.S7,
						ConnectionIns = s7Connection
					});
				}
				s7Connection.ConnectServer();
				break;
			}
			case EnumProtocol.ModbusTcp:
			{
				ModbusTcpNet modbusConnection;
				if (connectionPool.Any((Connection t) => t.DeviceId == device.Id && t.ConnectionIns.GetType() == typeof(ModbusTcpNet)))
				{
					modbusConnection = (ModbusTcpNet)connectionPool.FirstOrDefault((Connection t) => t.DeviceId == device.Id && t.ConnectionIns.GetType() == typeof(ModbusTcpNet)).ConnectionIns;
				}
				else
				{
					modbusConnection = new ModbusTcpNet(device.IP, device.Port, Convert.ToByte(device.Station))
					{
						AddressStartWithZero = device.AddressStartWithZero.Value,
						DataFormat = (DataFormat)Enum.Parse(typeof(DataFormat), device.DataFormat, ignoreCase: true),
						IsStringReverse = device.IsStringReverse.Value
					};
					connectionPool.Add(new Connection
					{
						DeviceId = device.Id,
						Protocol = EnumProtocol.ModbusTcp,
						ConnectionIns = modbusConnection
					});
				}
				modbusConnection.ConnectServer();
				break;
			}
			case EnumProtocol.ModbusRtu:
			{
				ModbusRtu modbusConnection2;
				if (connectionPool.Any((Connection t) => t.DeviceId == device.Id && t.ConnectionIns.GetType() == typeof(ModbusRtu)))
				{
					modbusConnection2 = (ModbusRtu)connectionPool.FirstOrDefault((Connection t) => t.DeviceId == device.Id && t.ConnectionIns.GetType() == typeof(ModbusRtu)).ConnectionIns;
				}
				else
				{
					modbusConnection2 = new ModbusRtu(Convert.ToByte(device.Station))
					{
						AddressStartWithZero = device.AddressStartWithZero.Value,
						DataFormat = (DataFormat)Enum.Parse(typeof(DataFormat), device.DataFormat, ignoreCase: true),
						IsStringReverse = device.IsStringReverse.Value
					};
					modbusConnection2.SerialPortInni(device.ComPort, Convert.ToInt32(device.BaudRate), Convert.ToInt32(device.DataBits), (StopBits)device.StopBits.Value, (Parity)device.Parity.Value);
					connectionPool.Add(new Connection
					{
						DeviceId = device.Id,
						Protocol = EnumProtocol.ModbusRtu,
						ConnectionIns = modbusConnection2
					});
				}
				modbusConnection2.Open();
				break;
			}
			case EnumProtocol.Socket:
			{
				TCPClient tcpConnection;
				if (connectionPool.Any((Connection t) => t.DeviceId == device.Id && t.ConnectionIns.GetType() == typeof(TCPClient)))
				{
					tcpConnection = (TCPClient)connectionPool.FirstOrDefault((Connection t) => t.DeviceId == device.Id && t.ConnectionIns.GetType() == typeof(TCPClient)).ConnectionIns;
				}
				else
				{
					tcpConnection = new TCPClient();
					connectionPool.Add(new Connection
					{
						DeviceId = device.Id,
						Protocol = EnumProtocol.Socket,
						ConnectionIns = tcpConnection
					});
				}
				try
				{
					tcpConnection.NetWork = new TcpClient();
					tcpConnection.NetWork.Connect(device.IP, device.Port);
					tcpConnection.SetProperties();
				}
				catch (Exception ex2)
				{
					MessageBox.Show("启动失败！\r设备[" + device.ShowName + "]连接失败：" + ex2.Message, "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
					return;
				}
				break;
			}
			default:
				throw new Exception($"未知的通信协议[{device.Protocol}]");
			}
		}
		if (!task.SocketServerId.HasValue)
		{
			Common.ExecuteTask(station, task, connectionPool, devices, null, ignoreTrigger: true);
		}
		else
		{
			Common.ExecuteTask(station, task, connectionPool, devices, new byte[0], ignoreTrigger: true);
		}
		foreach (Connection conn in connectionPool)
		{
			switch (conn.Protocol)
			{
			case EnumProtocol.OPCUA:
				(conn.ConnectionIns as OpcUaClient).Disconnect();
				break;
			case EnumProtocol.S7:
				(conn.ConnectionIns as SiemensS7Net).ConnectClose();
				break;
			case EnumProtocol.ModbusTcp:
				(conn.ConnectionIns as ModbusTcpNet).ConnectClose();
				break;
			case EnumProtocol.ModbusRtu:
				(conn.ConnectionIns as ModbusRtu).Close();
				break;
			case EnumProtocol.Socket:
				(conn.ConnectionIns as TCPClient).DisConnect();
				break;
			default:
				throw new Exception($"未知的通信协议[{conn.Protocol}]");
			}
		}
	}

	/// <summary>
	/// Clean up any resources being used.
	/// </summary>
	/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
	protected override void Dispose(bool disposing)
	{
		if (disposing && components != null)
		{
			components.Dispose();
		}
		base.Dispose(disposing);
	}

	/// <summary>
	/// Required method for Designer support - do not modify
	/// the contents of this method with the code editor.
	/// </summary>
	private void InitializeComponent()
	{
            this.components = new System.ComponentModel.Container();
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DAQMgrForm));
            this.tcMain = new System.Windows.Forms.TabControl();
            this.tpItems = new System.Windows.Forms.TabPage();
            this.btnUp = new System.Windows.Forms.Button();
            this.btnDown = new System.Windows.Forms.Button();
            this.btnDel = new System.Windows.Forms.Button();
            this.btnAdd = new System.Windows.Forms.Button();
            this.tvDAQItems = new System.Windows.Forms.TreeView();
            this.imageList = new System.Windows.Forms.ImageList(this.components);
            this.tpTasks = new System.Windows.Forms.TabPage();
            this.btnTaskUp = new System.Windows.Forms.Button();
            this.btnTaskDown = new System.Windows.Forms.Button();
            this.btnDelTask = new System.Windows.Forms.Button();
            this.btnAddTask = new System.Windows.Forms.Button();
            this.tvDAQTasks = new System.Windows.Forms.TreeView();
            this.cmbStations = new System.Windows.Forms.ComboBox();
            this.label1 = new System.Windows.Forms.Label();
            this.cmsDAQItem = new System.Windows.Forms.ContextMenuStrip(this.components);
            this.tsmiAdd = new System.Windows.Forms.ToolStripMenuItem();
            this.tsmiEdit = new System.Windows.Forms.ToolStripMenuItem();
            this.tsmiWriteValue = new System.Windows.Forms.ToolStripMenuItem();
            this.tsmiDel = new System.Windows.Forms.ToolStripMenuItem();
            this.tsmiSpliter = new System.Windows.Forms.ToolStripSeparator();
            this.tsmiExpandAll = new System.Windows.Forms.ToolStripMenuItem();
            this.tsmiCollapseAll = new System.Windows.Forms.ToolStripMenuItem();
            this.tsmiExpand = new System.Windows.Forms.ToolStripMenuItem();
            this.tsmiCollapse = new System.Windows.Forms.ToolStripMenuItem();
            this.pnlContainer = new System.Windows.Forms.Panel();
            this.cmsDAQTask = new System.Windows.Forms.ContextMenuStrip(this.components);
            this.tsmiEditTask = new System.Windows.Forms.ToolStripMenuItem();
            this.tsmiTriggerTask = new System.Windows.Forms.ToolStripMenuItem();
            this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
            this.tsmiDelTask = new System.Windows.Forms.ToolStripMenuItem();
            this.btnMonitor = new System.Windows.Forms.Button();
            this.tcMain.SuspendLayout();
            this.tpItems.SuspendLayout();
            this.tpTasks.SuspendLayout();
            this.cmsDAQItem.SuspendLayout();
            this.pnlContainer.SuspendLayout();
            this.cmsDAQTask.SuspendLayout();
            this.SuspendLayout();
            // 
            // tcMain
            // 
            this.tcMain.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
            | System.Windows.Forms.AnchorStyles.Left) 
            | System.Windows.Forms.AnchorStyles.Right)));
            this.tcMain.Controls.Add(this.tpItems);
            this.tcMain.Controls.Add(this.tpTasks);
            this.tcMain.Location = new System.Drawing.Point(3, 4);
            this.tcMain.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
            this.tcMain.Name = "tcMain";
            this.tcMain.SelectedIndex = 0;
            this.tcMain.Size = new System.Drawing.Size(573, 758);
            this.tcMain.TabIndex = 0;
            // 
            // tpItems
            // 
            this.tpItems.Controls.Add(this.btnUp);
            this.tpItems.Controls.Add(this.btnDown);
            this.tpItems.Controls.Add(this.btnDel);
            this.tpItems.Controls.Add(this.btnAdd);
            this.tpItems.Controls.Add(this.tvDAQItems);
            this.tpItems.Location = new System.Drawing.Point(4, 28);
            this.tpItems.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
            this.tpItems.Name = "tpItems";
            this.tpItems.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4);
            this.tpItems.Size = new System.Drawing.Size(565, 726);
            this.tpItems.TabIndex = 0;
            this.tpItems.Text = "采集项";
            this.tpItems.UseVisualStyleBackColor = true;
            // 
            // btnUp
            // 
            this.btnUp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
            this.btnUp.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("btnUp.BackgroundImage")));
            this.btnUp.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
            this.btnUp.Location = new System.Drawing.Point(504, 171);
            this.btnUp.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
            this.btnUp.Name = "btnUp";
            this.btnUp.Size = new System.Drawing.Size(45, 45);
            this.btnUp.TabIndex = 2;
            this.btnUp.UseVisualStyleBackColor = true;
            this.btnUp.Click += new System.EventHandler(this.btnUp_Click);
            // 
            // btnDown
            // 
            this.btnDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
            this.btnDown.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("btnDown.BackgroundImage")));
            this.btnDown.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
            this.btnDown.Location = new System.Drawing.Point(504, 225);
            this.btnDown.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
            this.btnDown.Name = "btnDown";
            this.btnDown.Size = new System.Drawing.Size(45, 45);
            this.btnDown.TabIndex = 3;
            this.btnDown.UseVisualStyleBackColor = true;
            this.btnDown.Click += new System.EventHandler(this.btnDown_Click);
            // 
            // btnDel
            // 
            this.btnDel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
            this.btnDel.BackgroundImage = global::WIT_DAQ_Core_Properties_Resour.del_black;
            this.btnDel.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
            this.btnDel.Location = new System.Drawing.Point(504, 63);
            this.btnDel.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
            this.btnDel.Name = "btnDel";
            this.btnDel.Size = new System.Drawing.Size(45, 45);
            this.btnDel.TabIndex = 1;
            this.btnDel.UseVisualStyleBackColor = true;
            this.btnDel.Click += new System.EventHandler(this.btnDel_Click);
            // 
            // btnAdd
            // 
            this.btnAdd.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
            this.btnAdd.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
            this.btnAdd.Image = global::WIT_DAQ_Core_Properties_Resour.add_black;
            this.btnAdd.Location = new System.Drawing.Point(504, 9);
            this.btnAdd.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
            this.btnAdd.Name = "btnAdd";
            this.btnAdd.Size = new System.Drawing.Size(45, 45);
            this.btnAdd.TabIndex = 0;
            this.btnAdd.UseVisualStyleBackColor = true;
            this.btnAdd.Click += new System.EventHandler(this.btnAdd_Click);
            // 
            // tvDAQItems
            // 
            this.tvDAQItems.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
            | System.Windows.Forms.AnchorStyles.Left) 
            | System.Windows.Forms.AnchorStyles.Right)));
            this.tvDAQItems.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.tvDAQItems.ImageIndex = 0;
            this.tvDAQItems.ImageList = this.imageList;
            this.tvDAQItems.ItemHeight = 14;
            this.tvDAQItems.Location = new System.Drawing.Point(0, 4);
            this.tvDAQItems.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
            this.tvDAQItems.Name = "tvDAQItems";
            this.tvDAQItems.SelectedImageIndex = 0;
            this.tvDAQItems.ShowNodeToolTips = true;
            this.tvDAQItems.Size = new System.Drawing.Size(494, 712);
            this.tvDAQItems.TabIndex = 7;
            this.tvDAQItems.NodeMouseDoubleClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.tvDAQItems_NodeMouseDoubleClick);
            this.tvDAQItems.KeyDown += new System.Windows.Forms.KeyEventHandler(this.tvDAQItems_KeyDown);
            this.tvDAQItems.MouseDown += new System.Windows.Forms.MouseEventHandler(this.tvDAQItems_MouseDown);
            // 
            // imageList
            // 
            this.imageList.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList.ImageStream")));
            this.imageList.TransparentColor = System.Drawing.Color.Transparent;
            this.imageList.Images.SetKeyName(0, "equipment.png");
            this.imageList.Images.SetKeyName(1, "equipment-#0078D7.png");
            this.imageList.Images.SetKeyName(2, "空白.png");
            this.imageList.Images.SetKeyName(3, "菱形-#0078D7.png");
            // 
            // tpTasks
            // 
            this.tpTasks.Controls.Add(this.btnTaskUp);
            this.tpTasks.Controls.Add(this.btnTaskDown);
            this.tpTasks.Controls.Add(this.btnDelTask);
            this.tpTasks.Controls.Add(this.btnAddTask);
            this.tpTasks.Controls.Add(this.tvDAQTasks);
            this.tpTasks.Location = new System.Drawing.Point(4, 28);
            this.tpTasks.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
            this.tpTasks.Name = "tpTasks";
            this.tpTasks.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4);
            this.tpTasks.Size = new System.Drawing.Size(565, 726);
            this.tpTasks.TabIndex = 1;
            this.tpTasks.Text = "任务定义";
            this.tpTasks.UseVisualStyleBackColor = true;
            // 
            // btnTaskUp
            // 
            this.btnTaskUp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
            this.btnTaskUp.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("btnTaskUp.BackgroundImage")));
            this.btnTaskUp.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
            this.btnTaskUp.Location = new System.Drawing.Point(504, 171);
            this.btnTaskUp.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
            this.btnTaskUp.Name = "btnTaskUp";
            this.btnTaskUp.Size = new System.Drawing.Size(45, 45);
            this.btnTaskUp.TabIndex = 13;
            this.btnTaskUp.UseVisualStyleBackColor = true;
            this.btnTaskUp.Click += new System.EventHandler(this.btnTaskUp_Click);
            // 
            // btnTaskDown
            // 
            this.btnTaskDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
            this.btnTaskDown.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("btnTaskDown.BackgroundImage")));
            this.btnTaskDown.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
            this.btnTaskDown.Location = new System.Drawing.Point(504, 225);
            this.btnTaskDown.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
            this.btnTaskDown.Name = "btnTaskDown";
            this.btnTaskDown.Size = new System.Drawing.Size(45, 45);
            this.btnTaskDown.TabIndex = 14;
            this.btnTaskDown.UseVisualStyleBackColor = true;
            this.btnTaskDown.Click += new System.EventHandler(this.btnTaskDown_Click);
            // 
            // btnDelTask
            // 
            this.btnDelTask.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
            this.btnDelTask.BackgroundImage = global::WIT_DAQ_Core_Properties_Resour.del_black;
            this.btnDelTask.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
            this.btnDelTask.Location = new System.Drawing.Point(504, 63);
            this.btnDelTask.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
            this.btnDelTask.Name = "btnDelTask";
            this.btnDelTask.Size = new System.Drawing.Size(45, 45);
            this.btnDelTask.TabIndex = 11;
            this.btnDelTask.UseVisualStyleBackColor = true;
            this.btnDelTask.Click += new System.EventHandler(this.btnDelTask_Click);
            // 
            // btnAddTask
            // 
            this.btnAddTask.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
            this.btnAddTask.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("btnAddTask.BackgroundImage")));
            this.btnAddTask.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
            this.btnAddTask.Location = new System.Drawing.Point(504, 9);
            this.btnAddTask.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
            this.btnAddTask.Name = "btnAddTask";
            this.btnAddTask.Size = new System.Drawing.Size(45, 45);
            this.btnAddTask.TabIndex = 12;
            this.btnAddTask.UseVisualStyleBackColor = true;
            this.btnAddTask.Click += new System.EventHandler(this.btnAddTask_Click);
            // 
            // tvDAQTasks
            // 
            this.tvDAQTasks.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
            | System.Windows.Forms.AnchorStyles.Left) 
            | System.Windows.Forms.AnchorStyles.Right)));
            this.tvDAQTasks.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.tvDAQTasks.ItemHeight = 14;
            this.tvDAQTasks.Location = new System.Drawing.Point(0, 4);
            this.tvDAQTasks.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
            this.tvDAQTasks.Name = "tvDAQTasks";
            this.tvDAQTasks.ShowNodeToolTips = true;
            this.tvDAQTasks.Size = new System.Drawing.Size(494, 712);
            this.tvDAQTasks.TabIndex = 10;
            this.tvDAQTasks.NodeMouseClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.tvDAQTasks_NodeMouseClick);
            this.tvDAQTasks.NodeMouseDoubleClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.tvDAQTasks_NodeMouseDoubleClick);
            this.tvDAQTasks.KeyDown += new System.Windows.Forms.KeyEventHandler(this.tvDAQTasks_KeyDown);
            // 
            // cmbStations
            // 
            this.cmbStations.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.cmbStations.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.cmbStations.FormattingEnabled = true;
            this.cmbStations.Location = new System.Drawing.Point(88, 24);
            this.cmbStations.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
            this.cmbStations.Name = "cmbStations";
            this.cmbStations.Size = new System.Drawing.Size(322, 26);
            this.cmbStations.TabIndex = 0;
            // 
            // label1
            // 
            this.label1.AutoSize = true;
            this.label1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.label1.Location = new System.Drawing.Point(18, 30);
            this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(62, 18);
            this.label1.TabIndex = 2;
            this.label1.Text = "站点：";
            // 
            // cmsDAQItem
            // 
            this.cmsDAQItem.ImageScalingSize = new System.Drawing.Size(24, 24);
            this.cmsDAQItem.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.tsmiAdd,
            this.tsmiEdit,
            this.tsmiWriteValue,
            this.tsmiDel,
            this.tsmiSpliter,
            this.tsmiExpandAll,
            this.tsmiCollapseAll,
            this.tsmiExpand,
            this.tsmiCollapse});
            this.cmsDAQItem.Name = "cmsDAQItem";
            this.cmsDAQItem.Size = new System.Drawing.Size(179, 266);
            // 
            // tsmiAdd
            // 
            this.tsmiAdd.Image = global::WIT_DAQ_Core_Properties_Resour.add_black;
            this.tsmiAdd.Name = "tsmiAdd";
            this.tsmiAdd.Size = new System.Drawing.Size(178, 32);
            this.tsmiAdd.Text = "添加采集项";
            this.tsmiAdd.Click += new System.EventHandler(this.tsmiAdd_Click);
            // 
            // tsmiEdit
            // 
            this.tsmiEdit.Image = global::WIT_DAQ_Core_Properties_Resour.edit_black;
            this.tsmiEdit.Name = "tsmiEdit";
            this.tsmiEdit.Size = new System.Drawing.Size(178, 32);
            this.tsmiEdit.Text = "编辑采集项";
            this.tsmiEdit.Click += new System.EventHandler(this.tsmiEdit_Click);
            // 
            // tsmiWriteValue
            // 
            this.tsmiWriteValue.Name = "tsmiWriteValue";
            this.tsmiWriteValue.Size = new System.Drawing.Size(178, 32);
            this.tsmiWriteValue.Text = "写入值(&W)";
            this.tsmiWriteValue.Click += new System.EventHandler(this.tsmiWriteValue_Click);
            // 
            // tsmiDel
            // 
            this.tsmiDel.Image = global::WIT_DAQ_Core_Properties_Resour.del_black;
            this.tsmiDel.Name = "tsmiDel";
            this.tsmiDel.Size = new System.Drawing.Size(178, 32);
            this.tsmiDel.Text = "删除采集项";
            this.tsmiDel.Click += new System.EventHandler(this.tsmiDel_Click);
            // 
            // tsmiSpliter
            // 
            this.tsmiSpliter.Name = "tsmiSpliter";
            this.tsmiSpliter.Size = new System.Drawing.Size(175, 6);
            // 
            // tsmiExpandAll
            // 
            this.tsmiExpandAll.Name = "tsmiExpandAll";
            this.tsmiExpandAll.Size = new System.Drawing.Size(178, 32);
            this.tsmiExpandAll.Text = "全部展开";
            this.tsmiExpandAll.Click += new System.EventHandler(this.tsmiExpandAll_Click);
            // 
            // tsmiCollapseAll
            // 
            this.tsmiCollapseAll.Name = "tsmiCollapseAll";
            this.tsmiCollapseAll.Size = new System.Drawing.Size(178, 32);
            this.tsmiCollapseAll.Text = "全部折叠";
            this.tsmiCollapseAll.Click += new System.EventHandler(this.tsmiCollapseAll_Click);
            // 
            // tsmiExpand
            // 
            this.tsmiExpand.Name = "tsmiExpand";
            this.tsmiExpand.Size = new System.Drawing.Size(178, 32);
            this.tsmiExpand.Text = "展开";
            this.tsmiExpand.Click += new System.EventHandler(this.tsmiExpand_Click);
            // 
            // tsmiCollapse
            // 
            this.tsmiCollapse.Name = "tsmiCollapse";
            this.tsmiCollapse.Size = new System.Drawing.Size(178, 32);
            this.tsmiCollapse.Text = "折叠";
            this.tsmiCollapse.Click += new System.EventHandler(this.tsmiCollapse_Click);
            // 
            // pnlContainer
            // 
            this.pnlContainer.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
            | System.Windows.Forms.AnchorStyles.Left) 
            | System.Windows.Forms.AnchorStyles.Right)));
            this.pnlContainer.Controls.Add(this.tcMain);
            this.pnlContainer.Location = new System.Drawing.Point(0, 78);
            this.pnlContainer.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
            this.pnlContainer.Name = "pnlContainer";
            this.pnlContainer.Size = new System.Drawing.Size(576, 764);
            this.pnlContainer.TabIndex = 2;
            // 
            // cmsDAQTask
            // 
            this.cmsDAQTask.ImageScalingSize = new System.Drawing.Size(24, 24);
            this.cmsDAQTask.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.tsmiEditTask,
            this.tsmiTriggerTask,
            this.toolStripSeparator1,
            this.tsmiDelTask});
            this.cmsDAQTask.Name = "cmsTask";
            this.cmsDAQTask.Size = new System.Drawing.Size(197, 106);
            // 
            // tsmiEditTask
            // 
            this.tsmiEditTask.Image = global::WIT_DAQ_Core_Properties_Resour.edit_black;
            this.tsmiEditTask.Name = "tsmiEditTask";
            this.tsmiEditTask.Size = new System.Drawing.Size(196, 32);
            this.tsmiEditTask.Text = "编辑任务";
            this.tsmiEditTask.Click += new System.EventHandler(this.tsmiEditTask_Click);
            // 
            // tsmiTriggerTask
            // 
            this.tsmiTriggerTask.Name = "tsmiTriggerTask";
            this.tsmiTriggerTask.Size = new System.Drawing.Size(196, 32);
            this.tsmiTriggerTask.Text = "手动触发任务";
            this.tsmiTriggerTask.Click += new System.EventHandler(this.tsmiTriggerTask_Click);
            // 
            // toolStripSeparator1
            // 
            this.toolStripSeparator1.Name = "toolStripSeparator1";
            this.toolStripSeparator1.Size = new System.Drawing.Size(193, 6);
            // 
            // tsmiDelTask
            // 
            this.tsmiDelTask.Image = global::WIT_DAQ_Core_Properties_Resour.del_black;
            this.tsmiDelTask.Name = "tsmiDelTask";
            this.tsmiDelTask.Size = new System.Drawing.Size(196, 32);
            this.tsmiDelTask.Text = "删除任务";
            this.tsmiDelTask.Click += new System.EventHandler(this.tsmiDelTask_Click);
            // 
            // btnMonitor
            // 
            this.btnMonitor.Location = new System.Drawing.Point(422, 22);
            this.btnMonitor.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
            this.btnMonitor.Name = "btnMonitor";
            this.btnMonitor.Size = new System.Drawing.Size(112, 34);
            this.btnMonitor.TabIndex = 1;
            this.btnMonitor.Text = "监控(&M)";
            this.btnMonitor.UseVisualStyleBackColor = true;
            this.btnMonitor.Click += new System.EventHandler(this.btnMonitor_Click);
            // 
            // DAQMgrForm
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(576, 842);
            this.Controls.Add(this.btnMonitor);
            this.Controls.Add(this.pnlContainer);
            this.Controls.Add(this.label1);
            this.Controls.Add(this.cmbStations);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
            this.Margin = new System.Windows.Forms.Padding(6, 6, 6, 6);
            this.MaximizeBox = false;
            this.Name = "DAQMgrForm";
            this.Text = "采集项&任务管理";
            this.Load += new System.EventHandler(this.DAQItemMgrForm_Load);
            this.tcMain.ResumeLayout(false);
            this.tpItems.ResumeLayout(false);
            this.tpTasks.ResumeLayout(false);
            this.cmsDAQItem.ResumeLayout(false);
            this.pnlContainer.ResumeLayout(false);
            this.cmsDAQTask.ResumeLayout(false);
            this.ResumeLayout(false);
            this.PerformLayout();

	}
}
